/**
 * 动态表格
 * 
 * @author 攻心小虫
 */
Ext.define('cceaf.control.DynamicGrid', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.dynamicGrid',
    url: '',	/**  从数据中获取数据  并且整理成grid特有的数据结构  **/
    visibleColumns: null,	/** 字段配置  **/
    initComponent: function() {
        var me = this;
        Ext.applyIf(me, {
            columns: [],
            forceFit: true,
            store: Ext.create('Ext.data.Store', {
                fields: [],
                listeners: {
                    'metachange': function(store, meta) {
                        me.reconfigure(store, meta.columns);
                    }
                },
                autoLoad: me.autoStore||false,
                remoteSort: false,
                remoteFilter: false,
                remoteGroup: false,
                proxy: {
                    reader: Ext.create('cceaf.control.DynamicReader', {
                        visibleColumns: me.visibleColumns
                    }),
                    actionMethods: {
                        read: 'POST'
                    },
                    type: 'rest',
                    url: me.url,
                    extraParams: me.params
                }
            })
        });
        me.callParent(arguments);
    }
});